<template>
  <div>
    test2
    <span>{{mylove}}</span>
    <button @click="handleClick">修改名字</button>
  </div>
</template>

<script lang="ts">
import { inject, ref } from 'vue'
export default {
  name: 'Test2',
  setup () {
    const name = ref< string >('xiaoxiaohua')
    const mylove = inject('mylove')
    const fun = inject('fun')
    const handleClick = () => {
      // @ts-ignore
      fun(name.value)
    }
    return {
      mylove,
      handleClick
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
